/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.front.entity;

import org.apache.commons.lang3.StringUtils;
import org.hibernate.validator.constraints.Length;

import com.thinkgem.jeesite.common.persistence.DataEntity;

/**
 * 职业性格测试管理Entity
 * @author 朱俊吉
 * @version 2017-11-29
 */
@SuppressWarnings("unused")
public class MbtiTheme extends DataEntity<MbtiTheme> {
	
	private static final long serialVersionUID = 1L;
	private String title;		// 题目
	private String part;		// 部分
	private String sequence;		// 序号
	private String choose;		// 选项
	private String answer;		// 答案
	
	
	private String chooseA;		//A选项
	private String chooseB;		//B选项
	private String answerA;		//A选项所属倾向
	private String answerB;		//B选项所属倾向

	public MbtiTheme() {
		super();
	}

	public MbtiTheme(String id){
		super(id);
	}

	@Length(min=0, max=255, message="题目长度必须介于 0 和 255 之间")
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}
	
	@Length(min=0, max=255, message="部分长度必须介于 0 和 255 之间")
	public String getPart() {
		return part;
	}

	public void setPart(String part) {
		this.part = part;
	}
	
	@Length(min=0, max=255, message="序号长度必须介于 0 和 255 之间")
	public String getSequence() {
		return sequence;
	}

	public void setSequence(String sequence) {
		this.sequence = sequence;
	}
	
	@Length(min=0, max=255, message="选项长度必须介于 0 和 255 之间")
	public String getChoose() {
		return choose;
	}

	public void setChoose(String choose) {
		this.choose = choose;
	}
	
	@Length(min=0, max=255, message="答案长度必须介于 0 和 255 之间")
	public String getAnswer() {
		return answer;
	}

	public void setAnswer(String answer) {
		this.answer = answer;
	}

	public String getChooseA() {
		if(StringUtils.isBlank(choose)){
			return "";
		}
		return choose.split("\\|")[0];
	}

	public String getChooseB() {
		if(StringUtils.isBlank(choose) || choose.split("\\|").length<2){
			return "";
		}
		return choose.split("\\|")[1];
	}

	public String getAnswerA() {
		if(StringUtils.isBlank(answer)){
			return "";
		}
		return answer.split("\\|")[0];
	}

	public String getAnswerB() {
		if(StringUtils.isBlank(answer) || answer.split("\\|").length<2){
			return "";
		}
		return answer.split("\\|")[1];
	}
	
}